package com.maycurobj.repository.bpm;

import com.maycurobj.entity.bpm.SuperiorInfoEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;


@Repository
public interface SuperiorUpdateMapper extends JpaRepository<SuperiorInfoEntity, Integer> {
    @Modifying
    @Transactional
    @Query(nativeQuery = true,value = "INSERT INTO h_org_direct_manager ( id, createdTime, creater, modifiedTime, modifier, remarks, userId, deptId, managerId )" +
            "VALUES ( :id, :date, NULL, :date, NULL, NULL, :userid, :deptId, :managerId )" +
            "ON DUPLICATE KEY UPDATE deptId =" +
            "VALUES (deptId),managerId= VALUES(managerId)")
    Integer updateSuperior(@Param(value = "id") String id, @Param(value = "date") String date, @Param(value = "userid") String userid, @Param(value = "deptId") String deptId, @Param(value = "managerId") String managerId);

}
